package com.weibei.common.utils.file;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;

@Component
public class QrUtil {

    /*@Autowired
    private WxMaService wxService;
    @Autowired
    private HuaWeiCloudUtil huaWeiCloudUtil;

    public void createQr(String scene, String code, int width, String path){

        String access_token = null;
        byte[] wxaCodeUnlimitBytes = null;
        try {
            access_token = this.wxService.getAccessToken();
            String fileName = "qr_image_1024_" + scene + ".png";
            String sceneStr = "invitationCodeMine=" + scene;
            String finalPath = path + "/" + fileName;
            WxMaQrcodeService qrcodeService = this.wxService.getQrcodeService();
            //String scene, String page, int width, boolean autoColor, WxMaCodeLineColor lineColor, boolean isHyaline
            wxaCodeUnlimitBytes = qrcodeService.createWxaCodeUnlimitBytes(sceneStr, code, width, true, null, false);
//            File file = FileUtils.createTempFile(finalPath, wxaCodeUnlimitBytes);
//            byte [] byteArr = file.getBytes();
            InputStream inputStream = new ByteArrayInputStream(wxaCodeUnlimitBytes);
            String name = "";
            huaWeiCloudUtil.storage(inputStream,name);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }*/
}
